package com.rxjava.simplezip;

/**
 * Created by iceGeneral on 2016/10/15.
 */
public class OnSubscribeLift<T, R> implements OnSubscribe<R> {

    final OnSubscribe<T> parent;
    final Operator<? extends R, ? super T> operator;

    public OnSubscribeLift(OnSubscribe<T> parent, Operator<? extends R, ? super T> operator) {
    	//parent -> subscriber.onNext(new Observable<?>[]{o1, o2});
    	this.parent = parent;
    	//operator -> OperatorZip对象
        this.operator = operator;
    }

    @Override
    public void call(Subscriber<? super R> r) {
    	System.out.println("step2");
    	//r -> System.out.println(s);
    	//st -> ZipSubscriber对象
        Subscriber<? super T> st = operator.call(r);
        System.out.println("step4");
        parent.call(st);
    }
}
